package com.gary.spring;


import com.gary.spring.cglib.Proxy;
import com.gary.spring.cglib.Target;

/**
 * @author peng_rui
 * @date 2022/7/4
 */
public class Start {
    public static void main(String[] args) {
        Target target = new Target();
        Proxy proxy = new Proxy();
        proxy.setMethodInterceptor((o, method, objects, methodProxy) -> {
            System.out.println("before ...");
//            method.invoke(target, objects); 反射调用
            return methodProxy.invokeSuper(o, objects);
        });

        proxy.save();
        proxy.save(1);
        proxy.save(1L);
    }
}
